#!/bin/bash

uykfd="java -jar ../uykfd-all-1.4.jar"
ntracks=100

aexponent=-2
atracks=$ntracks
aqueue=$atracks

xexponent=0
xtracks=$(($ntracks * 2))
xqueue=10

rm -fr playlists
mkdir playlists
pushd playlists

artists=`$uykfd show lastfm tagged artists`

echo "$artists" | while read artist
do

  qartist="\"$artist\""
  echo "$artist"

  $uykfd set ARTIST_MEMORY $xqueue
  $uykfd set ARTIST_DEXPONENT $xexponent
  prefix="xplore-"
  postfix=""
  file="$prefix$artist$postfix.m3u"
  while [ -e "$file" ]
  do
    postfix="$postfix "
    file="$prefix$artist$postfix.m3u"
  done
  $uykfd walk lastfm artist $qartist $xtracks backlinks > "$file" 2>&1

  $uykfd set ARTIST_MEMORY $aqueue
  $uykfd set ARTIST_DEXPONENT $aexponent
  prefix="around-"
  postfix=""
  file="$prefix$artist$postfix.m3u"
  while [ -e "$file" ]
  do
    postfix="$postfix "
    file="$prefix$artist$postfix.m3u"
  done
  $uykfd walk lastfm artist $qartist $atracks backlinks > "$file" 2>&1

done

